package bb.lanxing.model.json;

import android.text.TextUtils;

import com.umeng.socialize.net.utils.SocializeProtocolConstants;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.List;

import bb.lanxing.util.DateUtil;
import bb.lanxing.util.JsonUtil;
import bb.lanxing.util.MedalUtil;


public class RouteBookComment implements Serializable {
    private String content;
    private int id;
    private String imageUrl;
    private long informedUserId = 0;
    private String informedUserName = "";
    private int level;
    private String licenseNumberColor;
    private String licenseNumberSkin;
    private String medalSmall;
    private String plateNum;
    private String proName;
    private long time;
    private int type;
    private List<UserAvatarMedal> userAvatarMedals;
    private long userId;
    private String userName;
    private String userPic;

    public RouteBookComment(JSONObject jSONObject) throws JSONException {
        JSONArray jSONArray;
        JSONArray arrayValue;
        String str = "";
        String time = JsonUtil.getStringValue("createTime", jSONObject);
        if (!TextUtils.isEmpty(time)) {
            setTime(DateUtil.parse(time));
        }
        setUserId(JsonUtil.getLongValue("userId", jSONObject));
        setType(JsonUtil.getIntegerValue("type", jSONObject));
        setImageUrl(JsonUtil.getStringValue(SocializeProtocolConstants.IMAGE, jSONObject));
        setContent(JsonUtil.getStringValue("content", jSONObject));
        setUserPic(JsonUtil.getStringValue("avatar", jSONObject));
        setUserName(JsonUtil.getStringValue("createBy", jSONObject));
        setId(JsonUtil.getIntegerValue("id", jSONObject));
        setLevel(JsonUtil.getIntegerValue("level", jSONObject));
        setLicenseNumberColor(JsonUtil.getStringValue("license_number_color", jSONObject));
        setLicenseNumberSkin(JsonUtil.getStringValue("license_number_skin", jSONObject));
        if (jSONObject.has("medal_small") && (arrayValue = JsonUtil.getArrayValue("medal_small", jSONObject)) != null) {
            List<UserAvatarMedal> userAvatorMedalInfo = MedalUtil.getUserAvatorMedalInfo(arrayValue);
            if (userAvatorMedalInfo != null) {
                for (int i = 0; i < userAvatorMedalInfo.size(); i++) {
                    str = i == userAvatorMedalInfo.size() - 1 ? str + userAvatorMedalInfo.get(i).getUrl() : str + userAvatorMedalInfo.get(i).getUrl() + ";";
                }
                setMedalSmall(str);
            } else {
                setMedalSmall(null);
            }
            setUserAvatarMedals(userAvatorMedalInfo);
        }
        if (jSONObject.has("reply_user") && (jSONArray = jSONObject.getJSONArray("reply_user")) != null) {
            for (int i2 = 0; i2 < jSONArray.length(); i2++) {
                JSONObject jSONObject2 = jSONArray.getJSONObject(i2);
                setInformedUserId(JsonUtil.getLongValue("user_id", jSONObject2));
                setInformedUserName(JsonUtil.getStringValue("user_name", jSONObject2));
            }
        }
        setPlateNum(JsonUtil.getStringValue("license_number", jSONObject));
        setProName(JsonUtil.getStringValue("pro_name", jSONObject));
    }

    public RouteBookComment() {
    }

    public String getLicenseNumberSkin() {
        return this.licenseNumberSkin;
    }

    public void setLicenseNumberSkin(String str) {
        this.licenseNumberSkin = str;
    }

    public String getLicenseNumberColor() {
        return this.licenseNumberColor;
    }

    public void setLicenseNumberColor(String str) {
        this.licenseNumberColor = str;
    }

    public void setUserId(long j) {
        this.userId = j;
    }

    public void setLevel(int i) {
        this.level = i;
    }

    public int getLevel() {
        return this.level;
    }

    public void setMedalSmall(String str) {
        this.medalSmall = str;
    }

    public String getMedalSmall() {
        return this.medalSmall;
    }

    public List<UserAvatarMedal> getUserAvatarMedals() {
        return this.userAvatarMedals;
    }

    public void setUserAvatarMedals(List<UserAvatarMedal> list) {
        this.userAvatarMedals = list;
    }

    public void setType(int i) {
        this.type = i;
    }

    public void setImageUrl(String str) {
        this.imageUrl = str;
    }

    public void setContent(String str) {
        this.content = str;
    }

    public void setUserPic(String str) {
        this.userPic = str;
    }

    public void setTime(long j) {
        this.time = j;
    }

    public void setUserName(String str) {
        this.userName = str;
    }

    public void setId(int i) {
        this.id = i;
    }

    public long getUserId() {
        return this.userId;
    }

    public int getType() {
        return this.type;
    }

    public String getImageUrl() {
        return this.imageUrl;
    }

    public String getContent() {
        return this.content;
    }

    public String getUserPic() {
        return this.userPic;
    }

    public long getTime() {
        return this.time;
    }

    public String getUserName() {
        return this.userName;
    }

    public int getId() {
        return this.id;
    }

    public long getInformedUserId() {
        return this.informedUserId;
    }

    public String getInformedUserName() {
        return this.informedUserName;
    }

    public void setInformedUserId(long j) {
        this.informedUserId = j;
    }

    public void setInformedUserName(String str) {
        this.informedUserName = str;
    }

    public String getPlateNum() {
        return this.plateNum;
    }

    public void setPlateNum(String str) {
        this.plateNum = str;
    }

    public String getProName() {
        return this.proName;
    }

    public void setProName(String str) {
        this.proName = str;
    }
}
